package com.ruoyi.dynamic.controller.app;


import com.ruoyi.common.core.constant.constant.PathConstant;
import com.ruoyi.common.core.context.SecurityContextHolder;
import com.ruoyi.common.core.pojo.result.Pages;
import com.ruoyi.common.core.pojo.vo.PageVO;
import com.ruoyi.common.core.pojo.vo.SingleVO;
import com.ruoyi.common.core.result.Result;
import com.ruoyi.dynamic.model.pojo.entity.Gift;
import com.ruoyi.dynamic.model.pojo.request.app.AppGiftSearchRequest;
import com.ruoyi.dynamic.service.IGiftService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "App-礼物相关", description = "App-礼物相关")
@RestController
@RequestMapping(PathConstant.APP_PATH + "gift")
public class AppGiftController {

    @Autowired
    private IGiftService iGiftService;

    @Operation(summary = "礼物列表", description = "房间列表")
    @GetMapping("listPage")
    public PageVO<Gift> listPage(AppGiftSearchRequest request) {
        Long userId = SecurityContextHolder.getUserId();
        Pages<Gift> pages = iGiftService.listPage(request, userId);
        return Result.page(pages);
    }

    @Operation(summary = "礼物详情", description = "礼物详情")
    @GetMapping("info")
    public SingleVO<Gift> info(Long id) {
        return Result.single(iGiftService.getById(id));
    }


}

